package ch4;



import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;


@WebListener()
public class Mylistener implements
        ServletContextListener, HttpSessionListener, ServletRequestListener {
    public void  contextInitialized(ServletContextEvent arg0){
        System.out.println("ServletContext对象被创建了");
    }


    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("ServletContext对象被销毁l");
    }

    @Override
    public void requestDestroyed(ServletRequestEvent sre) {
        System.out.println("Request对象被销毁了");
    }

    @Override
    public void requestInitialized(ServletRequestEvent sre) {
        System.out.println("Request对象被创建了");
    }

    @Override
    public void sessionCreated(HttpSessionEvent se) {
        System.out.println("Session对象被创建了");
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        System.out.println("Session对象被销毁了");
    }
}
